home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10574 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  49 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.sprintlink.net!news1!ind-005-236-220
  3. From: dlmiller@iquest.net (Doug Miller)
  4. Subject: Re: HELP. How to convert '0x12' into FF char?
  5. X-Nntp-Posting-Host: ind-005-236-220.iquest.net
  6. Message-ID: <DoGtEt.Hwx@iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Organization: IQuest Network Services
  9. X-Newsreader: News Xpress Version 1.0 Beta #2.1
  10. References: <4iissm$s76@nntp.ucs.ubc.ca>
  11. Date: Mon, 18 Mar 1996 13:30:16 GMT
  12.  
  13. gordonw@unixg.ubc.ca (Gordon Wong) wrote:
  14. +Xref: news1 comp.lang.c:71002
  15. +Path: news1!news.sprintlink.net!howland.reston.ans.net!swrinde!sgigate.sgi.com!nntp.coast.net!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!in2.uu.net!van-bc!unixg.ubc.ca!news
  16. +From: gordonw@unixg.ubc.ca (Gordon Wong)
  17. +Newsgroups: comp.lang.c
  18. +Subject: HELP. How to convert '0x12' into FF char?
  19. +Date: Mon, 18 Mar 1996 05:40:13 GMT
  20. +Organization: The University of British Columbia
  21. +Lines: 17
  22. +Message-ID: <4iissm$s76@nntp.ucs.ubc.ca>
  23. +NNTP-Posting-Host: port38.annex2.net.ubc.ca
  24. +X-Newsreader: Forte Free Agent 1.0.81
  25. +
  26. +Let's say we have d='1' and e='2' and the following code segment:
  27. +:
  28. +:
  29. +f='0x';
  30. +strcpy(f,d);
  31. +strcpy(f,e);
  32. +
  33. +f now contains the string '0x12' right?
  34. +How would I write that out as a single ASCII FF character?
  35. +(d,e,f are char)
  36. +
  37. +Please reply here and email also if poss.  Thanks for any ideas.
  38. +
  39. +Gordon Wong, gordonw@unixg.ubc.ca
  40. +
  41. +Gordon Wong, gordonw@unixg.ubc.ca
  42. +
  43. int    hex;
  44. sscanf (f, "%x", &hex);
  45. printf ("%c", hex);
  46.  
  47. ....but please be aware that 0x12 is not an ASCII FF (form-feed) character.  0x12 is the ASCII
  48. DC2 character; the form-feed is *decimal* 12 or 0x0C.
  49.